<!-- 提示信息 -->
<app-tip [type]="tipType"></app-tip>
<app-load *ngIf="isLoading"></app-load>
<div class="header">
  <div class="left flex" [routerLink]="['/main/statistics']" id="btn-back">
    <div class="left-icon">
      <i class="fa fa-angle-left back-icon" aria-hidden="true"></i>
    </div>
    <div class="left-name">
      <span class="back-name">返回</span>
    </div>
  </div>
  <div class="center">日结统计台</div>
</div>

<div class="main">
  <div class="search-box" style="padding-bottom: .5em;padding-left: .5em;">
    <div class="search flex">
      <div class="input">
        <input type="date" class="search-input" [(ngModel)]="params.time" id="start-time" value="">
      </div>
      <div class="text" style="width: 40%">
        <span class="clear-data" style="padding:.4em 1em;margin-right: .5em;"
                                                            (click)="clearData()">清除</span>
        <span class="search-btn" style="padding: .4em 1em;"
                                                             (click)="getData(true)">搜索</span>
      </div>
    </div>
  </div>
  <!--今日统计数据-->
  <div class="card">
    <div class="title" style="border-left: 3px solid #f0ad4e;">今日统计数据</div>
    <div class="content">
      <table>
        <tr>
          <td>总出台数：{{result.totalObj['todayNum']}}</td>
          <td>到店人数：{{result.totalObj['peopleNum']}}</td>
        </tr>
        <tr>
          <td>预账单数量：{{result.totalObj['statementNum']}}</td>
          <td>结账单数量：{{result.totalObj['settlementNum']}}</td>
        </tr>
        <tr>
          <td>今日应收金额：<span class="text-success">￥{{result.totalObj['orderTotal'] | price}}</span></td>
          <td>今日实收金额：<span class="text-success">￥{{result.totalObj['orderSettlementMoney'] | price}}</span></td>
        </tr>
        <tr>
          <td>
            挂账单数量：<span *ngIf="result.totalObj['creditNum'] == 0">{{result.totalObj['creditNum']}}</span>
            <span class="text-red" *ngIf="result.totalObj['creditNum'] > 0">{{result.totalObj['creditNum']}}</span>
          </td>
          <td>
            挂账单金额：<span *ngIf="result.totalObj['creditMoney'] == 0">{{result.totalObj['creditMoney']}}</span>
            <span class="text-red" *ngIf="result.totalObj['creditMoney'] > 0">￥{{result.totalObj['creditMoney'] | price}}</span>
          </td>
        </tr>
        <tr>
          <td>
            免单数量：<span *ngIf="result.totalObj['freeNum'] == 0">{{result.totalObj['freeNum']}}</span>
            <span class="text-warn" *ngIf="result.totalObj['freeNum'] > 0">{{result.totalObj['freeNum']}}</span>
          </td>
          <td>
            免单金额：<span *ngIf="result.totalObj['freeMoney'] == 0">{{result.totalObj['freeMoney']}}</span>
            <span class="text-warn"
                  *ngIf="result.totalObj['freeMoney'] > 0">￥{{result.totalObj['freeMoney'] | price}}</span>
          </td>
        </tr>
        <tr>
          <td>
            招待单数量：<span *ngIf="result.totalObj['entertainNum'] == 0">{{result.totalObj['entertainNum']}}</span>
            <span class="text-warn" *ngIf="result.totalObj['entertainNum'] > 0">{{result.totalObj['entertainNum']}}</span>
          </td>
          <td>
            招待单金额：<span *ngIf="result.totalObj['entertainMoney'] == 0">{{result.totalObj['entertainMoney']}}</span>
            <span class="text-warn"
                  *ngIf="result.totalObj['entertainMoney'] > 0">￥{{result.totalObj['entertainMoney'] | price}}</span>
          </td>
        </tr>
        <tr>
          <td>
            优惠账单数量：<span *ngIf="result.totalObj['concessionNum'] == 0">{{result.totalObj['concessionNum']}}</span>
            <span class="text-warn" *ngIf="result.totalObj['concessionNum'] > 0">{{result.totalObj['concessionNum']}}</span>
          </td>
          <td>
            优惠账单金额：<span *ngIf="result.totalObj['concessionMoney'] == 0">{{result.totalObj['concessionMoney']}}</span>
            <span class="text-warn"
                  *ngIf="result.totalObj['concessionMoney'] > 0">￥{{result.totalObj['concessionMoney'] | price}}</span>
          </td>
        </tr>
        <tr>
          <td>撤单数量：{{result.totalObj['revokeNum']}}</td>
          <td>实际收款金额：<span *ngIf="result.totalObj['realincome'] == 0">{{result.totalObj['realincome']}}</span>
            <span class="text-success"
                  *ngIf="result.totalObj['realincome'] > 0">￥{{result.totalObj['realincome'] | price}}</span></td>
        </tr>
      </table>
    </div>
    <!--按支付方式统计-->
    <div class="card">
      <div class="title" style="border-left: 3px solid #005983">支付方式统计</div>
      <div class="content">
        <table>
          <tr>
            <td>支付方式名称</td>
            <td>支付金额</td>
          </tr>
          <tr *ngFor="let v of result.payList;let i = index;">
            <td>{{v.name}}</td>
            <td>￥{{v.money | price}}</td>
          </tr>
        </table>
      </div>
    </div>
    <!--按会员卡统计-->
    <div class="card">
      <div class="title" style="border-left: 3px solid #605ca8">会员卡统计</div>
      <div class="content">
        <table>
          <tr>
            <td>今日会员卡充值总额</td>
            <td>￥{{result.card['cardRecharge'] | price}}</td>
          </tr>
          <tr>
            <td>今日会员卡充值实际支付总额</td>
            <td>￥{{result.card['cardPayMoney'] | price}}</td>
          </tr>
          <tr>
            <td>今日会员卡消费总额</td>
            <td>￥{{result.card['cardConsumption'] | price}}</td>
          </tr>
          <tr>
            <td>今日会员卡积分消费总额</td>
            <td>￥{{result.card['integralConsumption'] | price}}</td>
          </tr>
          <tr>
            <td>今日会员卡积分充值总额</td>
            <td>￥{{result.card['integralRecharge'] | price}}</td>
          </tr>
          <tr>
            <td>今日新办会员数</td>
            <td>{{result.card['todayAddCard']}}张</td>
          </tr>
        </table>
      </div>
    </div>
    <!--按打印机出票统计-->
    <div class="card">
      <div class="title" style="border-left: 3px solid #d9534f">打印机出票统计</div>
      <div class="content">
        <table>
          <tr>
            <td>打印机名称</td>
            <td>出菜数量</td>
            <td>总金额</td>
          </tr>
          <tr *ngFor="let v of result.printList">
            <td>{{v.name}}</td>
            <td>{{v.item}}</td>
            <td>￥{{v.total_price | price}}</td>
          </tr>
        </table>
      </div>
    </div>
    <!--按菜品分类统计-->
    <div class="card">
      <div class="title" style="border-left: 3px solid #5cb85c">菜品分类统计</div>
      <div class="content">
        <table>
          <tr>
            <td>分类名称</td>
            <td>出菜数量</td>
            <td>总金额</td>
          </tr>
          <tr *ngFor="let v of result.doshesList">
            <td>{{v.name}}</td>
            <td>{{v.item}}</td>
            <td>￥{{v.total | price}}</td>
          </tr>
        </table>
      </div>
    </div>


    <div class="load-data" *ngIf="loading">
      <p class="load-data-icon">
        <i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
      </p>
      <p class="load-data-text">
        数据加载中
      </p>
    </div>
    <!--<div class="no-data" *ngIf="!list.length && isFlag">-->
    <!--<p class="load-data-description">-->
    <!--<i class="fa fa-info-circle"></i> <span>暂无统计数据</span>-->
    <!--</p>-->
    <!--</div>-->
  </div>
</div>
